# Makefile for Unit-testing



#================================================================
# Setting Variables
#================================================================


# Generic settings
SHELL = /bin/sh

# Targets
TARGET = allTests
OBJS = allTests.o check_skelbdb.o

LIBDIR = -Lembunit/lib -L. -L.. -L$(HOME)/lib -L/usr/local/lib -L/opt/local/lib 
INCLUDEDIR = -Iembunit -I. -I.. -I$(HOME)/include -I/usr/local/include -I/opt/local/include

# Building binaries
CC = gcc
CFLAGS = -std=c99 -Wall -fPIC -fsigned-char -DDEBUG
LIBS = -lembUnit -ljansson -ltokyocabinet -lz -lresolv -lpthread -lm -lc -luuid
CPPFLAGS = $(INCLUDEDIR) $(LIBDIR)

LDFLAGS = $(LIBDIR) $(LIBS)
LDENV = LD_RUN_PATH=/lib:/usr/lib:$(HOME)/lib:/usr/local/lib:/opt/local/lib:.:..



#================================================================
# Suffix rules
#================================================================


.SUFFIXES :
.SUFFIXES : .c .o

.c.o :
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<



#================================================================
# Actions
#================================================================

all : embunit $(TARGET)
	@true

embunit :	
	-@cd ./embunit/          ;$(MAKE)
#@true

clean :
	rm -rf $(TARGET) *.exe *.o a.out check.out gmon.out leak.log casket* *~ *.tcb
	#-@cd ./embunit          ;$(MAKE) clean

check : all
	-./$(TARGET)



.PHONY : all clean check embunit



#================================================================
# Building binaries
#================================================================

$(TARGET): $(OBJS)
	$(LDENV) $(CC) $(CFLAGS) $(CPPFLAGS) -o $@  ../tcskelbdb.o $(OBJS) $(LDFLAGS) $(LIBS)


# END OF FILE
